The global_removal argument is the _name_ of the object.
We were comparing it to the _object id_ of the object.
To fix this, store the name at the time the object is bound.
} else if (strcmp(interface, "wl_output") == 0) {
output =
wl_registry_bind(display_wayland->wl_registry, id, &wl_output_interface, 1);
- _gdk_wayland_screen_add_output(display_wayland->screen, output);
+ _gdk_wayland_screen_add_output(display_wayland->screen, id, output);
/* We need to roundtrip until we've received the modes and
* geometry events for the output, which gives us the physical
* properties and available modes on the output. */
/* We don't know what this item is - try as an output */
_gdk_wayland_screen_remove_output_by_id (display_wayland->screen, id);
+
+ /* FIXME: the object needs to be destroyed here, we're leaking */
}
static const struct wl_registry_listener registry_listener = {
int height);
GdkScreen *_gdk_wayland_screen_new (GdkDisplay *display);
-void _gdk_wayland_screen_add_output (GdkScreen *scren,
+void _gdk_wayland_screen_add_output (GdkScreen *screen,
+ guint32 id,
struct wl_output *output);
void _gdk_wayland_screen_remove_output_by_id (GdkScreen *screen,
guint32 id);
struct _GdkWaylandMonitor
{
GdkWaylandScreen *screen;
+ guint32 id;
struct wl_output *output;
GdkRectangle geometry;
int width_mm;
};
void
-_gdk_wayland_screen_add_output (GdkScreen *screen,
+_gdk_wayland_screen_add_output (GdkScreen *screen,
+ guint32 id,
struct wl_output *output)
{
GdkWaylandScreen *screen_wayland = GDK_WAYLAND_SCREEN (screen);
GdkWaylandMonitor *monitor = g_new0(GdkWaylandMonitor, 1);
+ monitor->id = id;
monitor->output = output;
monitor->screen = screen_wayland;
g_ptr_array_add(screen_wayland->monitors, monitor);
{
GdkWaylandMonitor *monitor = screen_wayland->monitors->pdata[i];
- if (wl_proxy_get_id ((struct wl_proxy *)monitor->output) == id)
+ if (monitor->id == id)
{
g_ptr_array_remove (screen_wayland->monitors, monitor);